<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1,user-scalable=no">
    <title>将图层添加到3D场景</title>
    <style>
        html,body,#viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>
    <link rel="stylesheet" href="https://js.arcgis.com/4.17/esri/css/main.css">
    <script src="https://js.arcgis.com/4.17/"></script>
    <script>
        // 应用程序可以访问和显示托管在ArcGIS Online 或 ArcGIS 上的要素图层
        // 每个托管要素层都有一个带有唯一URL的REST端点
        // FeatureLayer类可以使用URL访问和绘制地图的点，线，面的特征
        // 如果尚未为托管要素图层预定义诸如渲染器或弹出窗口之类的属性，则地图将使用默认符号，并且不会启用弹出窗口
        require([
            'esri/Map',
            'esri/views/SceneView',
            'esri/layers/FeatureLayer'
        ],function(
            Map,
            secneView,
            FeatureLayer
        ) {
            var map = new Map({
                basemap:"topo-vector",
                ground:"world-elevation"
            });

            var view = new secneView({
                container:"viewDiv",
                map:map,
                camera:{
                    position: {
                        x: -118.808,
                        y: 33.961,
                        z: 2000  // meters
                    },
                    tilt:75  // 倾斜角度
                },
            });

            // 点要素图层
            // 创建一个新的FeatureLayer并将url属性设置为Trailheads（点）要素服务
            // 将要素图层添加到Map
            var featureLayer = new FeatureLayer({
                url:"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0"
            });
            map.add(featureLayer);

            // 添加要素图层
            // lines
            var trailsLayer = new FeatureLayer({
                url:"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0"
            });
            map.add(trailsLayer, 0);

            // polygons 多边形
            var parkLayer = new FeatureLayer({
                url:"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space/FeatureServer/0"
            });
            map.add(parkLayer,0);

            // “ Trailheads”，“ Trails”以及“公园和开放空间”要素服务没有与之关联的样式
            // 因此要素图层使用默认符号在地图上绘制它们
            // 但可以配置图层
        })
    </script>
</head>
<body>
    <div id="viewDiv"></div>
</body>
</html>